const http= require('http');
const fs= require('fs');
const url= require('url');
 
http.createServer(function (req, res) {
    let pathname=req.url;
    if(pathname=='/'){
        pathname='index.html'
        
    }
    if (pathname!=='./favicon.ico') {
        fs.readFile('./static/'+pathname,(err,data)=>{
            if(err){
                console.log(404);
                return;
            }
            res.writeHead(200, {'Content-Type': 'text/html;charset="utf-8"'});
            res.write(data)
            res.end();
        })
    }
  

}).listen(8081);